import sys
sys.path.insert(0, 'packages.zip')


def webapp_add_wsgi_middleware(app):
    import beaker.middleware
    import os
    session_opts = {
        'session.cookie_domain': os.environ['SERVER_NAME'],
        'session.cookie_expires': True,
        'session.type': 'cookie',
        'session.validate_key': 'secret'
    }
    return beaker.middleware.SessionMiddleware(app, session_opts)
